/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主题色彩 */
    --primary-color: #00d4ff;
    --secondary-color: #ff6b6b;
    --accent-color: #4ecdc4;
    --bg-dark: #0a0e1a;
    --bg-light: #1a1f2e;
    --text-primary: #ffffff;
    --text-secondary: #b8c5d1;
    --text-muted: #6c7a89;
    
    /* 动画时间 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* 字体 */
    --font-primary: 'Noto Sans SC', 'Inter', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    --font-size-4xl: 2.5rem;
    
    /* 间距 */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* 边角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);
}

body {
    font-family: var(--font-primary);
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
}

/* 屏幕管理 */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
    z-index: 1;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    z-index: 10;
}

/* 语言切换按钮 */
.language-toggle {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 1000;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: var(--font-size-sm);
    font-weight: 500;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    min-width: 60px;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

.current-lang {
    font-weight: 600;
}

.dropdown-arrow {
    font-size: 0.8em;
    transition: transform var(--transition-fast);
}

.lang-btn:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* 语言选择器弹窗 */
.language-selector {
    position: fixed;
    background: rgba(26, 31, 46, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm);
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all var(--transition-fast);
    z-index: 10001;
}

.language-selector.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.language-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

.language-option:hover {
    background: rgba(0, 212, 255, 0.1);
    transform: translateX(2px);
}

.language-option.active {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(78, 205, 196, 0.2));
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.lang-code {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 30px;
    text-align: center;
    font-size: var(--font-size-xs);
}

.lang-name {
    flex: 1;
    text-align: left;
    margin-left: var(--spacing-sm);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.language-option.active .lang-name {
    color: var(--primary-color);
    font-weight: 500;
}

/* 滚动条样式 */
.language-selector::-webkit-scrollbar {
    width: 4px;
}

.language-selector::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.language-selector::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
}

.language-selector::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* 烟花选择器样式 */
.firework-selector {
    font-family: var(--font-primary);
}

.firework-selector::-webkit-scrollbar {
    width: 4px;
}

.firework-selector::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.firework-selector::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
}

.firework-option {
    position: relative;
}

.firework-option:hover {
    background: rgba(0, 212, 255, 0.15) !important;
    transform: translateX(2px);
}

.firework-option .firework-icon {
    margin-right: 8px;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.firework-option .firework-name {
    flex: 1;
    font-weight: 500;
}

/* 烟花通知样式 */
.firework-notification {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    animation: fireworkNotification 2s ease-out forwards;
}

@keyframes fireworkNotification {
    0% {
        transform: scale(0) translateY(0);
        opacity: 0;
    }
    20% {
        transform: scale(1.1) translateY(-5px);
        opacity: 1;
    }
    100% {
        transform: scale(1) translateY(-10px);
        opacity: 1;
    }
}

/* 主菜单样式 */
#mainMenu {
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1f2e 50%, #2a2f3e 100%);
    position: relative;
}

.menu-container {
    text-align: center;
    z-index: 2;
    position: relative;
}

.game-title {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
}

.game-subtitle {
    font-size: var(--font-size-xl);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-2xl);
    font-weight: 300;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: center;
}

.menu-btn {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(78, 205, 196, 0.1));
    border: 2px solid transparent;
    background-clip: padding-box;
    color: var(--text-primary);
    padding: var(--spacing-md) var(--spacing-2xl);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: var(--font-size-lg);
    font-weight: 500;
    position: relative;
    width: 250px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius-lg);
    padding: 2px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: xor;
    -webkit-mask-composite: xor;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.menu-btn:hover::before {
    opacity: 1;
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.menu-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 背景粒子动画 */
.bg-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.bg-particles::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(78, 205, 196, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(255, 107, 107, 0.1) 0%, transparent 50%);
    animation: floating 20s ease-in-out infinite;
}

@keyframes floating {
    0%, 100% { transform: translateX(-10%) translateY(-10%) rotate(0deg); }
    50% { transform: translateX(-5%) translateY(-5%) rotate(180deg); }
}

/* 游戏界面样式 */
#gameScreen {
    background: var(--bg-dark);
    padding: 0;
}

.game-container {
    width: 100%;
    height: 100vh;
    display: grid;
    grid-template-rows: 1fr auto auto;
    grid-template-areas: 
        "story"
        "choices"
        "ui";
}

.story-panel {
    grid-area: story;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "image text";
    padding: var(--spacing-lg);
    gap: var(--spacing-lg);
}

.scene-image {
    grid-area: image;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.scene-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-text {
    grid-area: text;
    padding: var(--spacing-lg);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.scene-title {
    font-size: var(--font-size-2xl);
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
    font-weight: 600;
}

.story-content {
    font-size: var(--font-size-lg);
    line-height: 1.8;
    color: var(--text-primary);
}

.choices-panel {
    grid-area: choices;
    padding: var(--spacing-lg);
}

.choices-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    max-width: 800px;
    margin: 0 auto;
}

.choice-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: var(--font-size-base);
    text-align: left;
    position: relative;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.choice-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--primary-color);
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.choice-btn::before {
    content: '→';
    position: absolute;
    left: var(--spacing-md);
    opacity: 0;
    transition: opacity var(--transition-fast);
    color: var(--primary-color);
}

.choice-btn:hover::before {
    opacity: 1;
}

.choice-btn:hover {
    padding-left: calc(var(--spacing-lg) + var(--spacing-md));
}

.game-ui {
    grid-area: ui;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background: rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ui-left, .ui-right {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.ui-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: var(--font-size-sm);
}

.ui-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary-color);
}

.progress-indicator {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* 成就界面 */
.achievements-container, .timeline-container, .settings-container {
    background: rgba(255, 255, 255, 0.05);
    padding: var(--spacing-2xl);
    border-radius: var(--radius-xl);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.achievements-container h2, .timeline-container h2, .settings-container h2 {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    color: var(--primary-color);
    font-size: var(--font-size-3xl);
}

.achievements-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.achievement-item {
    background: rgba(255, 255, 255, 0.05);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all var(--transition-fast);
}

.achievement-item:hover {
    border-color: var(--accent-color);
    background: rgba(78, 205, 196, 0.1);
}

.achievement-item.unlocked {
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.1);
}

.achievement-title {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.achievement-desc {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* 时间线可视化 */
.timeline-viz {
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    min-height: 300px;
}

/* 设置界面 */
.settings-options {
    margin-bottom: var(--spacing-xl);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item label {
    color: var(--text-primary);
    font-weight: 500;
}

.setting-item input[type="range"] {
    width: 150px;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

/* 返回按钮 */
.back-btn {
    background: linear-gradient(135deg, var(--secondary-color), #ff8a80);
    border: none;
    color: white;
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: var(--font-size-base);
    font-weight: 600;
    display: block;
    margin: 0 auto;
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* 加载界面 */
#loadingScreen {
    background: var(--bg-dark);
}

.loading-container {
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 212, 255, 0.3);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-lg);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 动画类 */
.fade-in {
    animation: fadeIn var(--transition-normal) ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in-left {
    animation: slideInLeft var(--transition-normal) ease-out;
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-in-right {
    animation: slideInRight var(--transition-normal) ease-out;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}